/**
 Copyright (C) 2013 Yuyao Liang

 This source code is release under the BSD License.

 This program is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE.  See the license for more details.

 Created on Nov 7, 2013 1:53:31 PM
 */
package com.googlecode.backtest.document;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import com.googlecode.backtest.dataset.manager.BackTestDataManager;
import com.googlecode.backtest.dataset.provider.DataProvider;

/**
 * @author lianyuy
 * 
 */
@SuppressWarnings("hiding")
@XmlRootElement(name = "BackTestContent")
@XmlType(name = "BackTestContentType")
public class BackTestContent<Item> implements IBackTestContent<Item> {
	@XmlAttribute
	private final String ID = getClass().getName();
	@XmlAttribute
	private final String Version = Messages
			.getString("BackTestContent.VERSION");
	@XmlElement(name = "ProcessItems")
	private List<Item> items = new ArrayList<Item>();
	@XmlElement(name = "DataProvider")
	private DataProvider provider;
	@XmlElement(name = "DataManager")
	private BackTestDataManager manager;

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.google.srclib.base.IDable#getID()
	 */
	@Override
	public String getID() {
		return ID;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.google.srclib.base.Versionable#getVersion()
	 */
	@Override
	public String getVersion() {
		return Version;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.googlecode.backtest.document.IBackTestContent#setContent(java.lang
	 * .Object)
	 */
	@Override
	public void addContent(Item content) {
		items.add(content);

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.googlecode.backtest.document.IBackTestContent#getContent(int)
	 */
	@Override
	public Item getContent(int index) {
		return items.get(index);
	}

	/**
	 * @param provider
	 *            the provider to set
	 */
	public void setprovider(DataProvider provider) {
		this.provider = provider;
	}

	public DataProvider getProvider() {
		return this.provider;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.googlecode.backtest.document.IBackTestContent#getIterator()
	 */
	@Override
	public Iterator<Item> getIterator() {
		return items.iterator();
	}

}
